home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 February
/
Macworld (1999-02).dmg
/
Cinema 4D GO demo
/
Gumption Plug-ins
/
Plug-ins
/
Freeware
/
ResolveLoops
/
ResolveLoops.cof
Wrap
Text File
|
1998-03-19
|
2KB
|
107 lines
// ResolveLoops
// resolve a looped sequence in a sequence without loops
// You can select a sequence, track or an entire object
// Christian Losch
// (c) 1998 MAXON Computer
DoSequence(seq,fps)
{
var count,arr,i,j,key,si,loops,diff;
si = new(SequenceInfo);
seq->GetSequenceInfo(si);
diff = si->to - si->from + 1.0/fps;
si->to = diff*(si->loops+1) - 1.0/fps;
loops = si->loops; if (loops==0) return; // nothing to do
si->loops = 0;
seq->SetSequenceInfo(si);
// Countkeys
count=0;
key = seq->GetFirstKey();
while (key)
{
count++;
key = key->GetNext();
}
arr = new(array,count);
// Insert Data
count=0;
key = seq->GetFirstKey();
while (key)
{
arr[count] = key->GetTime();
count++;
key = key->GetNext();
}
key = seq->GetFirstKey();
for (i=0; i<count; i++)
{
for (j=0; j<loops; j++)
seq->CloneKey(arr[i]+diff*(j+1),key);
key = key->GetNext();
}
}
DoTrack(track,fps)
{
var seq = track->GetFirstSequence();
while (seq)
{
DoSequence(seq,fps);
seq = seq->GetNext();
}
}
DoObject(op,fps)
{
var track = op->GetFirstTrack();
while (track)
{
DoTrack(track,fps);
track = track->GetNext();
}
}
Function(doc)
{
var op,track,seq;
op = doc->FindFirstActiveAObject();
track = doc->FindFirstActiveATrack();
seq = doc->FindFirstActiveASequence();
if (op)
{
DoObject(op,doc->GetFps());
doc->SendMessage(ACTIVE_OBJECT_CHANGED);
}
else if (track)
{
DoTrack(track,doc->GetFps());
doc->SendMessage(ACTIVE_OBJECT_CHANGED);
}
else if (seq)
{
DoSequence(seq,doc->GetFps());
doc->SendMessage(ACTIVE_OBJECT_CHANGED);
}
else
{
TextDialog("Please select a sequence,| track or object");
return;
}
}
main()
{
RegisterMenuHook("Resolve Loops","Function");
}